//package Client.common;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * This class is TableH
 */
public class TableH extends DefaultTableCellRenderer{

	/**
	 * TableH variables
	 */
	private static final long serialVersionUID = -2520714867209949742L;

	private Color colors[][];
	/**
	* Constructs an instance of TableH.
	*/	
	public TableH(Color[][] cellColors){
		super();
		this.colors = cellColors;
	}
	
	
	/**
	 * @param table
	 * @param obj
	 * @param isSelected
	 * @param hasFocus
	 * @param row
	 * @param column
	 * @return cell
	 */
	public Component getTableCellRendererComponent (JTable table, Object obj, boolean isSelected, 
		boolean hasFocus, int row, int column) {
		
		Component cell = super.getTableCellRendererComponent(table, obj, false, false, row, column); 
		
		cell.setBackground(colors[column][row]);
		setHorizontalAlignment(SwingConstants.CENTER);
		return cell;
	}

}
